package com.zzl.finance.data.constant;

import com.zzl.finance.data.dto.KeyValueDto;

import java.util.ArrayList;
import java.util.List;

/**
 * 企业评级枚举值
 *
 * @author : spp
 * @date : 2021/12/2 15:13
 */
public enum EnterPriseGradeEnum {

    /**
     * 企业评级，Ⅰ级最大
     */
    ONE(1, "Ⅰ级"),

    TWO(2, "Ⅱ级"),

    THREE(3, "Ⅲ级"),

    FOR(4, "Ⅳ级"),

    FIVE(5, "Ⅴ级");


    private final Integer code;

    private final String value;


    EnterPriseGradeEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public static String getValue(Integer code) {
        for (EnterPriseGradeEnum statusEnum : EnterPriseGradeEnum.values()) {
            if (statusEnum.code.equals(code)) {
                return statusEnum.value;
            }
        }
        return "";
    }

    /**
     * 获取企业 评级 map 值
     *
     * @return map
     */
    public static List<KeyValueDto> getEnumMap() {
        List<KeyValueDto> list = new ArrayList<>();
        for (EnterPriseGradeEnum statusEnum : EnterPriseGradeEnum.values()) {
            KeyValueDto keyValueDto = new KeyValueDto();
            keyValueDto.setCode(statusEnum.getCode());
            keyValueDto.setValue(statusEnum.getValue());
            list.add(keyValueDto);
        }
        return list;
    }


    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }
}
